//Saturday, December 19 2009
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <math.h>
#include <sstream>
#include <algorithm>

using namespace std;

class AvoidingProduct
{
public:
	vector <int> getTriple(vector <int> a, int n)
	{
		int gap = 0x7fffffff;
		int xx = 0;
		int yy = 0;
		int zz = 0;
		set<int> v(a.begin(), a.end());
		for(int x=1; x<n+52; x++)
		{
// 			cout << v.count(x) << endl;
			if(v.count(x)!=0) continue;
			for(int y=1; y<n+52; y++)
			{
				if(v.count(y)!=0) continue;
				if(x*y > 3000) break;
				for(int z=1; z<n+52; z++)
				{
					if(v.count(z)!=0) continue;
					int temp = x*y*z;
					if(abs(n - temp) < gap)
					{
						xx = x;
						yy = y;
						zz = z;
						gap = abs(n - temp);
						cout << xx << ", " << yy << ", " << zz << endl;
					}
					if(temp > n)
						break;
				}
			}
		}
		vector<int> ret;
		ret.push_back(xx);
		ret.push_back(yy);
		ret.push_back(zz);
		return ret;
	}
};
